package com.example.highclasscomponent.adapter;

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.example.highclasscomponent.LaunchFragment;

public class FragmentLaunchAdapter extends FragmentPagerAdapter {
    private final int[] mImageList;

    public FragmentLaunchAdapter(@NonNull FragmentManager fm,int[] imageList) {
        super(fm,BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
        this.mImageList=imageList;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return LaunchFragment.newInstance(mImageList.length,position,mImageList[position]);
    }

    @Override
    public int getCount() {
        return mImageList.length;
    }
}
